<template>
  <div style="height: calc(100vh - 180px); position: relative;">
    <div class="box-wrapper" v-show="!dialog1">
      <search @search="handleSearchByKeyword" @add="handleOpenDialog" />
      <ms-table :table-props="tableProps" :data-api="dataUrl" ref="dataTable">
        <el-table-column label="操作栏" slot="tool">
          <template slot-scope="scope">
            <el-button
              size="mini"
              v-permission="['studentTest:save']"
              @click="handleOpenDialog(scope.row.id)">编辑</el-button>
            <el-button
              size="mini"
              type="danger"
              @click="handleDelRow(scope.row.id)"
              v-permission="['studentTest:del']"
              >删除</el-button>
          </template>
        </el-table-column>
      </ms-table>
    </div>
    <info ref="infoForm" v-show="dialog1" :title="title" :dialog-visible="dialog1" :form-id="formId" @dataFresh="handleCanleDialog" @close="handleCanleDialog" />
  </div>
</template>

<script>
import { MsTable } from '@/common/table'
import Info from './Info'
import Search from './Search'
import common from '@/mixins/common'
export default {
  components: {
    MsTable,
    Info,
    Search
  },
  mixins: [common],
  data() {
    return {
      tableProps: [
        { index: 'name', label: '学生姓名' },
        { index: 'sex', label: '性别', dict: 'sex' },
        { index: 'birthday', label: '生日' },
        { index: 'createTime', label: '创建时间' }
      ],
      dataUrl: '/work/studentTest/list',
      delUrl: '/work/studentTest/del',
      mainTitle: '学生测试'
    }
  }
}
</script>
